﻿Imports System.Collections.Specialized
Imports System.IO
Imports System.Globalization
Imports Microsoft.TeamFoundation.Client
Imports Microsoft.TeamFoundation.WorkItemTracking.Client
Imports System.Collections.ObjectModel


Partial Public Class CreateWit

    Public Window As MainWindow

    Private m_SelectedProject As project
    Private m_SelectedWIT As WorkItemType

    Private Sub ux_CancelButton_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles ux_CancelButton.Click
        ' CType(Window.Resources("HideCredentialProviderBox"), Storyboard).Begin(Window)
        Window.HideHeatITSMSelectionScreen()
    End Sub

    Private Sub ux_ProjectSelect_SelectionChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs) Handles ux_ProjectSelect.SelectionChanged
        ' TODO: Rebuild Types
        m_SelectedProject = ux_ProjectSelect.SelectedItem
    End Sub

    Private Sub CreateWit_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        ' Clear existing menu items
        Me.DataContext = Application.WorkItemStore
        LoadProjects
    End Sub


    Private Sub LoadProjects()
        If Not Application.TFServer Is Nothing AndAlso Application.TFServer.HasAuthenticated Then
            Me.ux_ProjectSelect.ItemsSource = Application.WorkItemStore.Projects
        End If
    End Sub

    Private Sub LoadWITs(ByVal Project As Project)
        ux_WITSelect.ItemsSource = m_SelectedProject.WorkItemTypes
    End Sub

End Class
